/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.mala.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "roles_modulos", catalog = "mala", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "RolesModulos.findAll", query = "SELECT r FROM RolesModulos r")})
public class RolesModulos implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected RolesModulosPK rolesModulosPK;
    @Column(name = "incluir")
    private Boolean incluir;
    @Column(name = "alterar")
    private Boolean alterar;
    @Column(name = "consultar")
    private Boolean consultar;
    @Column(name = "excluir")
    private Boolean excluir;
    @JoinColumn(name = "modulo_id", referencedColumnName = "modulo_id", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Modulos modulos;
    @JoinColumn(name = "role_id", referencedColumnName = "role_id", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Roles roles;

    public RolesModulos() {
    }

    public RolesModulos(RolesModulosPK rolesModulosPK) {
        this.rolesModulosPK = rolesModulosPK;
    }

    public RolesModulos(int roleId, int moduloId) {
        this.rolesModulosPK = new RolesModulosPK(roleId, moduloId);
    }

    public RolesModulosPK getRolesModulosPK() {
        return rolesModulosPK;
    }

    public void setRolesModulosPK(RolesModulosPK rolesModulosPK) {
        this.rolesModulosPK = rolesModulosPK;
    }

    public Boolean getIncluir() {
        return incluir;
    }

    public void setIncluir(Boolean incluir) {
        this.incluir = incluir;
    }

    public Boolean getAlterar() {
        return alterar;
    }

    public void setAlterar(Boolean alterar) {
        this.alterar = alterar;
    }

    public Boolean getConsultar() {
        return consultar;
    }

    public void setConsultar(Boolean consultar) {
        this.consultar = consultar;
    }

    public Boolean getExcluir() {
        return excluir;
    }

    public void setExcluir(Boolean excluir) {
        this.excluir = excluir;
    }

    public Modulos getModulos() {
        return modulos;
    }

    public void setModulos(Modulos modulos) {
        this.modulos = modulos;
    }

    public Roles getRoles() {
        return roles;
    }

    public void setRoles(Roles roles) {
        this.roles = roles;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rolesModulosPK != null ? rolesModulosPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RolesModulos)) {
            return false;
        }
        RolesModulos other = (RolesModulos) object;
        if ((this.rolesModulosPK == null && other.rolesModulosPK != null) || (this.rolesModulosPK != null && !this.rolesModulosPK.equals(other.rolesModulosPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.mala.entity.RolesModulos[ rolesModulosPK=" + rolesModulosPK + " ]";
    }
    
}
